﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Dixon_Q_Test
{
    class Matrix
    {
        private double[,] mt;
        int n;
        int m;

        public Matrix()
        {
            this.m = 1;
            this.n = 1;
            this.mt = new double[n, m];
            this.mt[0, 0] = 0;
        }

        public Matrix(int n, int m)
        {
            this.m = m;
            this.n = n;
            this.mt = new double[n, m];
            for (int i = 0; i < n; i++)
                for (int j = 0; j < m; j++)
                    this.mt[i, j] = 0;
        }

        public Matrix(Matrix mt1)
        {
            this.m = mt1.m;
            this.n = mt1.n;
            this.mt = new double[n, m];
            for (int i = 0; i < 100; i++)
                for (int j = 0; j < 100; j++)
                    this.mt[i, j] = mt1.mt[i, j];
        }

        public double getElement(int n, int m)
        {
            return this.mt[n, m];
        }

        public bool readDisxonTable(String file)
        {
            StreamReader sr = new StreamReader(file);
            try
            {
                string str = sr.ReadLine();
                string[] s = str.Split(' ');
                this.n = int.Parse(s[0]);
                this.m = int.Parse(s[1]);
                this.mt = new double[n, m];
                for (int i = 0; i < this.n; i++)
                {
                    str = sr.ReadLine();
                    s = str.Split(' ');
                    for (int j = 0; j < this.m; j++)
                    {
                        this.mt[i, j] = double.Parse(s[j]);

                    }
                }
                sr.Close();
            }
            catch
            {
                sr.Close();
                return false;
            }
            return true;
        }


    }
}
